package mxmf.service;

import java.io.File;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class CmsConfigService {

    @Value("${chances.cms.audit-service-url:'http://ip:port'}")
    private String auditUrl;

    @Value("${chances.cms.create-audit-service-url}")
    private String createAuditPublishUrl;

    @Value("${chances.cms.create-skip-audit-service-url}")
    private String skipAuditPublishUrl;

    @Value("${chances.cms.basic-service-url}")
    private String basicServerUrl;

    @Value("${chances.cms.upload-root}")
    private File uploadRoot;

    @Value("${chances.cms.picture-root}")
    private File pictureRoot;

    @Value("${chances.cms.encode-url:'http://localhost/encode'}")
    private String encodeUrl;

    @Value("${chances.cms.preview-dir:'/opt/preview/'}")
    private String previewDir;

    @Value("${chances.cms.preview-url:'http://localhost/preview/'}")
    private String previewUrl;

    @Value("${chances.cms.c2.gate.task.notify:'http://localhost/collectNotify'}")
    private String collectNotifyUrl;

    public File getUploadRoot() {
        return uploadRoot;
    }

    public File getPictureRoot() {
        return pictureRoot;
    }

    public String getRecycleURL() {
        return basicServerUrl + "/recycle/recycle/create";
    }

    public String getContentOnlineURL() {
        return auditUrl + "/audit/online";
    }

    public String getContentDenyURL() {
        return auditUrl + "/audit/deny";
    }

    public String getEncodeUrl() {
        return encodeUrl;
    }

    public String getPreviewDir() {
        return previewDir;
    }

    public String getPreviewUrl() {
        return previewUrl;
    }

    public String getCollectNotifyUrl(Long taskId) {
        return collectNotifyUrl + "/" + taskId;
    }

    public String getSkipAuditPublishUrl() {
        return skipAuditPublishUrl;
    }

    public String getCreateAuditPublishUrl() {
        return createAuditPublishUrl;
    }
}
